﻿@model List<Lehnet.Models.DTO.MusteriAdres>

@{Html.RenderPartial("FancyRequireScripts");}
<script>
    function CloseAndUpdate() {

        parent.jQuery.fancybox.close();
    }
    function confirmDelete(musteriAdresId) {
        if (confirm("Kaydı silmek istediğinizden emin misiniz?") == false)
            return;
        DeleteMusteriAdresAjax(musteriAdresId);
    }
    function DeleteMusteriAdresAjax(musteriAdresId) {
        $.ajax({
            url: '/MusteriAdresi/DeleteMusteriAdresiAjax',
            data: {
                musteriAdresId: musteriAdresId
            },
            dataType: 'json',
            contentType: 'application/json; charset=utf-8',
            success: function (data) {
                location.reload(true);
            }
        });
    }
</script>
<link rel="stylesheet" type="text/css" href="/Content/css/GuzelTable.css" />
<div style="width: 100%; text-align: right;">
    <a href="#" title="Kapat" onclick="CloseAndUpdate()">
        <input type="button" value="Kapat" /></a>
</div>
<a href="@Url.Action("Create", "MusteriAdresi", new { musteriId = @ViewBag.MusteriId })">
    <img src="/Content/IconImages/plus.png" /></a>
@{
    <table class="bordered">
        <thead>
            <tr>
                <th>Adres</th>
                <th>Aciklama</th>
                <th>Adres Tipi</th>
                <th>İl</th>
                <th>İlçe</th>
                <th>İlgili Kişi</th>
                <th>Müşteri</th>
                <th>Değiştir</th>
                <th>Sil</th>
            </tr>
        </thead>
        @foreach (Lehnet.Models.DTO.MusteriAdres ma in Model)
        {
            <tr>
                <td>@ma.Adres</td>
                <td>@ma.Aciklama</td>
                <td>@ma.AdresTipi</td>
                <td>@ma.Il</td>
                <td>@ma.Ilce</td>
                <td>@ma.IlgiliKisi</td>
                <td>@ma.MusteriAd</td>
                <td><a href="@Url.Action("Create", "MusteriAdresi", new { id = @ma.Id, musteriId = @ViewBag.MusteriId })">Değiştir</a></td>
                <td><a href="#" onclick="confirmDelete(@ma.Id)">sil</a></td>
            </tr>
        }
    </table>
}

